# -*- coding: utf-8 -*-
"""
Created on Mon Oct  2 13:21:59 2022

@author: wulong
"""

'''
profit = 0.001 CAD/s
'''

import numpy as np

def Weight_EMPC(uc_lo, uc_up, x_lo, x_up):
    
    delta_y1 = 0.02
    delta_y2 = 0.001
    eco = 0.0013*2*0.86
    ye = np.array([delta_y1, delta_y2])
    delta_state = 0.08*(x_up - x_lo)
    delta_input = 0.01*(uc_up - uc_lo)
    
    wet_y1 = 1/delta_y1**2
    wet_y2 = 1/delta_y2**2
    wet_eco = 1/eco
    wet_ye = 1/ye**2
    wet_x = 1/delta_state**2
    wet_u = 1/delta_input**2
    
    wet_xs = np.append(np.insert(wet_x[18:21], 0, wet_x[16]), wet_x[22])
    wet_xf1 = np.append(np.append(wet_x[:5], wet_x[15]), wet_x[17])
    wet_xf2 = np.append(np.append(wet_x[5:9], wet_x[14]), wet_x[21])
    wet_xf3 = wet_x[9:14].copy()
    
    wet_uf1 = np.append(wet_u[0], wet_u[6])
    wet_uf2 = wet_u[1].copy()
    wet_uf3 = wet_u[3].copy()
    
    wet = (wet_eco, wet_ye, wet_y1, wet_y2, wet_xs,
           wet_xf1, wet_xf2, wet_xf3, wet_uf1, wet_uf2, wet_uf3)
    
    return wet
